package com.deli.service.impl;

import com.deli.entity.Admin;
import com.deli.mapper.AdminMapper;
import com.deli.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("adminService")
@Transactional
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public List<Admin> findByExemple(String workCode) throws Exception {
        Admin admin = new Admin();
        admin.setWorkCode(workCode);
        List<Admin> admins = adminMapper.findByExemple(admin);
        if (admins == null || admins.size() <= 0) {
            throw new Exception("您不是管理员，无法查看");
        }
        return admins;
    }


}
